<?php
    class test_index_controller extends controllerBase
    {
        public function process()
        {
            /*$oDatabase = new database();
            $aData = array(
            'name' => 'Triệu Quang Phục, cộng hòa xã hội chủ nghĩa việt nam, độc lập tự do hạnh phúc',
            'total' => 354,
            );
            $oDatabase->add('product',$aData);

            $uri = URL::getLink('product/id/product_100');
            $oDatabase->deleteResources($uri);

            $filenameIn  = 'http://trimundauden.vn/wp-content/uploads/mat-na-tri-mun-dau-den-bang-dau-tay-1.jpg';
            $filenameOut = 'upload/test_image.jpg';

            $contentOrFalseOnFailure   = file_get_contents($filenameIn);
            $byteCountOrFalseOnFailure = file_put_contents($filenameOut, $contentOrFalseOnFailure);*/

            //database::setSetting('test1','ta la test 1.5','test1','test','ta vua update 1 lan ne');
            //database::setSetting('test2','ta la test 1.999');
            //database::setSetting('test3','ta la test 1','','test');
            /*print_r(database::getSetting('test1'));
            print_r(database::getListSettings('test'));*/
            /*$stext = "lksdfklsda falskd f               ksdaf lasdf sdalkf l              dafksd fsdfksd ksdf asdfsadfsadfsdafa sdf sadf sadf asdf sadfsdaf akldsf ksdf asdf asdf sad asd fsadf sadf asf sdaf sd df    sdfaf asdf asdf sd sdf sadf ";
            echo '<textarea style = "width:200px;height:100px;">';
            echo $stext;
            echo '</textarea>';
            $stext = preg_replace('!\s{2,}!', "\n", $stext);
            echo '<textarea style = "width:200px;height:100px;">';
            echo $stext;
            echo '</textarea>';*/
            
            /*$str = 'http://images.hotdeals.vn/images/03-01-2014/Bộ 2 Loa Xí Ngầu/51693_0_body_01.jpg';
            echo '<textarea>';
            print_r(explode('/',$str));
            echo '</textarea>';*/
            
            $sQuery = " 
            PREFIX foaf: <http://xmlns.com/foaf/0.1/>
            PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
            PREFIX bus: <".URL::getLink("id/bussiness#").">

            SELECT * 
            WHERE
            {
            ?uri rdf:type bus:category.
            ?uri bus:name ?name .
            ?uri bus:defaultImage ?image.
            OPTIONAL { ?uri bus:subCategory ?pCategory}.
            ?uri foaf:mbox ?box.
            } ";
            $oDatabase = new database();
            $aResults = $oDatabase->loadQuery($sQuery);
            echo '<textara>';
            print_r($aResults['result']['rows']);
            echo '</textara>';
            if(!empty($aResults['result']['rows']))
            {
                echo 'NOT NULL';
            }
            else
            {
                echo 'NULL';
            }
        }
    }
?>
